package com.kikyou.api;


import com.kikyou.pojo.Department;
import com.kikyou.pojo.RespBean;
import com.kikyou.service.IDepartmentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuankaiqiang
 * @since 2022-03-08
 */
@RestController
@RequestMapping("/org/dep")
public class DepartmentController {
    @Autowired
    private IDepartmentService departmentService;
    @ApiOperation(value = "组织架构")
    @GetMapping("/allDep")
    public List<Department> getAllDepartment(){
         return departmentService.getAllDepartment();
    }
    @ApiOperation(value = "添加部门")
    @PostMapping("/addDep")
    public RespBean addDep(@RequestBody Department dep) {
        return departmentService.addDep(dep);
    }

    @ApiOperation(value = "删除部门")
    @DeleteMapping("/{id}")
    public RespBean deleteDep(@PathVariable Integer id) {
        return departmentService.deleteDep(id);
    }
}
